home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / Tools / MotifApp / ch7 / DialogTestWindow.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-03  |  1.8 KB  |  58 lines

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////
  3. //         This example code is from the book:
  4. //
  5. //           Object-Oriented Programming with C++ and OSF/Motif
  6. //         by
  7. //           Douglas Young
  8. //           Prentice Hall, 1992
  9. //           ISBN 0-13-630252-1    
  10. //
  11. //         Copyright 1991 by Prentice Hall
  12. //         All Rights Reserved
  13. //
  14. //  Permission to use, copy, modify, and distribute this software for 
  15. //  any purpose except publication and without fee is hereby granted, provided 
  16. //  that the above copyright notice appear in all copies of the software.
  17. ///////////////////////////////////////////////////////////////////////////////
  18. //////////////////////////////////////////////////////////////////////////////
  19.  
  20.  
  21. //////////////////////////////////////////////////////////
  22. // DialogTestWindow.C: Test the InfoDialogManager class
  23. /////////////////////////////////////////////////////////
  24. #include "DialogTestWindow.h"
  25. #include "InfoDialogManager.h"
  26. #include <stdio.h>
  27. #include <Xm/PushB.h>
  28.  
  29. void postDialogCallback ( Widget, XtPointer, XtPointer );
  30.  
  31. Widget DialogTestWindow::createWorkArea ( Widget parent )
  32. {
  33.     Widget button = XtCreateManagedWidget ( "push_to_test", 
  34.                        xmPushButtonWidgetClass,
  35.                        parent, 
  36.                        NULL, 0 );
  37.     
  38.     XtAddCallback ( button,
  39.            XmNactivateCallback,
  40.            postDialogCallback,
  41.            NULL );
  42.     return button;
  43. }
  44.  
  45. void postDialogCallback ( Widget, XtPointer, XtPointer )
  46. {
  47.     static int counter = 1;
  48.     char buf[100];
  49.     
  50.     // Generate a unique message for each dialog
  51.     
  52.     sprintf ( buf, "Information Dialog Number %d\n", counter++ );
  53.     
  54.     // Display the message
  55.     
  56.     theInfoDialogManager->post ( buf );
  57. }
  58.